package com.liuwang.meal.adapter;

import com.liuwang.meal.R;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.Gallery;

public class ButtonAdapter extends BaseAdapter
{
	// 定义Context
	private Context	mContext;		
	// 定义整型数组 即图片源
	private String[] menu_type;

	// 声明 ImageAdapter
	public ButtonAdapter(Context c)
	{
		mContext = c;
		menu_type=c.getResources().getStringArray(R.array.menu_type);
	}

	// 获取图片的个数
	public int getCount()
	{
		return menu_type.length;
	}

	// 获取图片在库中的位置
	public Object getItem(int position)
	{
		return position;
	}

	// 获取图片ID
	public long getItemId(int position)
	{
		return position;
	}

	public View getView(int position, View convertView, ViewGroup parent)
	{
		if (convertView!=null) {
			
		}else {
		
		}
		Button button=new Button(mContext);
		button.setText(menu_type[position]);
		
		button.setLayoutParams(new Gallery.LayoutParams(120, 40));
		return button;
	}
}

